Иногда нужно выполнить блок кода с несколькими менеджерами контекста:
with open('f') as f: with open('g') as g: with open('h') as h: pass
Начиная с Python 2.7 и 3.1, это можно записать в одной конструкции with:
o = open with o('f') as f, o('g') as g, o('h') as h: pass
Раньше для этого использовали функцию contextlib.nested:
with nested(o('f'), o('g'), o('h')) as (f, g, h): pass
Если же число менеджеров контекста заранее неизвестно, лучше подойдёт более продвинутый инструмент. contextlib.ExitStack позволяет открывать любое число контекстов в произвольный момент, но гарантирует корректный выход из них в конце:
with ExitStack() as stack: f = stack.enter_context(o('f')) g = stack.enter_context(o('g')) other = [ stack.enter_context(o(filename)) for filename in filenames ]
Иногда нужно выполнить блок кода с несколькими менеджерами контекста:
with open('f') as f: with open('g') as g: with open('h') as h: pass
Начиная с Python 2.7 и 3.1, это можно записать в одной конструкции with:
o = open with o('f') as f, o('g') as g, o('h') as h: pass
Раньше для этого использовали функцию contextlib.nested:
with nested(o('f'), o('g'), o('h')) as (f, g, h): pass
Если же число менеджеров контекста заранее неизвестно, лучше подойдёт более продвинутый инструмент. contextlib.ExitStack позволяет открывать любое число контекстов в произвольный момент, но гарантирует корректный выход из них в конце:
with ExitStack() as stack: f = stack.enter_context(o('f')) g = stack.enter_context(o('g')) other = [ stack.enter_context(o(filename)) for filename in filenames ]
The cloud-based messaging platform is also adding Anonymous Group Admins feature. As per Telegram, this feature is being introduced for safer protests. As per the Telegram blog post, users can “Toggle Remain Anonymous in Admin rights to enable Batman mode. The anonymized admin will be hidden in the list of group members, and their messages in the chat will be signed with the group name, similar to channel posts.”
Look for Channels Online
You guessed it – the internet is your friend. A good place to start looking for Telegram channels is Reddit. This is one of the biggest sites on the internet, with millions of communities, including those from Telegram.Then, you can search one of the many dedicated websites for Telegram channel searching. One of them is telegram-group.com. This website has many categories and a really simple user interface. Another great site is telegram channels.me. It has even more channels than the previous one, and an even better user experience.These are just some of the many available websites. You can look them up online if you’re not satisfied with these two. All of these sites list only public channels. If you want to join a private channel, you’ll have to ask one of its members to invite you.